/*
 * @Author: sdq 483657864@qq.com
 * @Date: 2025-04-17 17:01:38
 * @LastEditors: sdq 483657864@qq.com
 * @LastEditTime: 2025-04-18 15:58:43
 * @FilePath: \ranyu_anchor_new\src\store\modules\agroa\modules\userStatus.ts
 * @Description: 当前用户对于声网的状态
 */

/**
 * 应用状态管理（浅层响应式）
 * @property isInitialized - SDK 是否完成初始化
 * @property isJoined - 是否已加入频道
 * @property isSpeaking - 本地用户是否正在发言
 * @property networkQuality - 上行网络质量评分（0-6，0 最好）
 */

interface VoiceStatus {
  isInitialized: boolean;
  isJoined: boolean;
  isSpeaking: boolean;
  networkQuality: number;
}
import { defineStore } from "pinia";
export const useLiveStatusStore = defineStore("liveStatus", {
  state: (): VoiceStatus => ({
    isInitialized: false,
    isJoined: false,
    isSpeaking: false,
    networkQuality: 0,
  }),
  actions: {
    changeInitialize(status: boolean) {
      this.isInitialized = status;
    },
    changeJoinStatus(status: boolean) {
      this.isJoined = status;
    },
    changeSpeakingStatus(status: boolean) {
      this.isSpeaking = status;
    },
    changenetworkQuality(network: number) {
      this.networkQuality = network;
    },
  },
});
